﻿function showAouthor(txtID,txtName)
{
      txtID=document.getElementById(txtID);
      txtName=document.getElementById(txtName);
      var args =new Array(2);//接受对话框返回值 
      var sFeatures="dialogHeight:410px;dialogWidth:270px;help=no; status=no; scroll=no; resizable=yes;";
      args[0]=txtID.value;
      args[1]=txtName.value;
      window.showModalDialog('../Author/Tree.aspx?SelectID=' + args[0],args,sFeatures);     
      txtID.value=args[0];
      txtName.value=args[1];     
      return false;
}

//列表页中的删除按钮
  function otherDelete(nowID, hidIDs) {
            hidIDs = document.getElementById(hidIDs);           
             
            if (hidIDs.value == "") {
                alert("未选中项");
                return;
            }
            else {
                if (confirm('确定要删除吗？')) {
                    document.getElementById(nowID).click();
                }
            }
        }
        
 //列表页的全选
 function SelectAll() {
    var chkSelectAll = event.srcElement;
    for (i = 0; i < lvList.all.length; i++) {
        var sub = lvList.all[i];
        if (sub.type == "checkbox") {
            if (sub.checked != chkSelectAll.checked) {
                sub.click();
            }
        }
    }
}

function SelectAll2() {
    var b = $("#chkSelectAll").attr("checked");
    $("#lvList").find("[type='checkbox']:not([disabled])").each(function () {
        if ($(this).attr("checked") != b) {
            
            $(this).attr("checked", b);
        }
    });
}

//选中后对隐藏域赋值
function SetSelectID(txtID) {
    var blnChecked = event.srcElement.checked;
    txtHidden = document.getElementById('ctl00_ContentPlaceHolder1_hidIDs');
    var idValue = txtHidden.value;

    if (blnChecked) {
        if (idValue == "") {
            idValue = ",";
        }
        idValue += txtID + ",";
    }
    else {

        idValue = idValue.replace("," + txtID + ",", ",");
        if (idValue == ",") {
            idValue = "";
        }
    }
    txtHidden.value = idValue;
}

$(document).ready(function () {
    $("input[number]").keypress(function (e) {
        if ((e.which >= 48 && e.which <= 57) || (e.which == 8) ) {
            return true;
        }
        else {
            return false;
        }
    });

    $("input[multinumber]").keypress(function (e) {
        if ((e.which >= 48 && e.which <= 57) || (e.which == 8) || (e.which == 44)) {
            return true;
        }
        else {
            return false;
        }
    });
});

function ShowIP(ip_lable, ip) {
    
    disp_ip = $("#" + ip_lable);

    $.ajax({
        url: "http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=" + ip,
        success:tt,
        dataType: 'json'
    });
    function tt(result) {
        if (result && disp_ip && result.Ret >= 0) {
            alert(result.Province);
            //disp_ip.text(result.Province + " " + result.City);
        } 
    }
    //$.get("Ajax_IPAddress.asp?ipaddr=" + ip, ShowIPCallback);
}

